import { createStore } from "vuex";

import axios from "axios";

const store = createStore({
    state(){
        return{
            srllerlis:{},
            goodslis:[]
        }
    },
    getters:{

    },
    mutations:{
      fun1(state,payload){
           state.srllerlis = payload.data
        //    console.log(state.srllerlis,"-----------     ")
      },


      setGoods(state,payload){
        state.goodslis = payload.data
         console.log(state.goodslis);
   }


    },
    actions:{
     async Seller({commit}){
        const{data:{data}} = await axios.get("/api/seller");
        commit("fun1",{
            data
        })
     },

     async getGoods({ commit }) {
        const {
          data: { data },
        } = await axios.get("/api/goods");
        commit("setGoods", { data });
  
  
      },

    },
     
   
   
     
    
})

export default store